package Day09_Ex1_inheritence_poly;

public class Bicycle implements Comparable<Bicycle>
{

    int cadence = 0;
    int speed = 0;
    int gear = 1;

    public Bicycle(int c, int s, int g)
    {
        this.cadence = c;
        this.speed = s;
        this.gear = g;
    }

    void changeCadence(int newValue)
    {
        cadence = newValue;
    }

    void changeGear(int newValue)
    {
        gear = newValue;
    }

    void speedUp(int increment)
    {
        speed = speed + increment;
    }

    void applyBrakes(int decrement)
    {
        speed = speed - decrement;
    }

    void printDescription()
    {
        System.out.println("\nBike is in gear " + this.gear + " with a cadence of " +
        this.cadence + " and travelling at a speed of " + this.speed + ". ");

    }

	@Override
	public int compareTo(Bicycle o) {
		if (this.gear < o.gear) return -1;
		else if (this.gear > o.gear) return 1;
		else return 0;
	}
}
